package cn.tedu.buycradserver.controller;

import cn.tedu.buycradserver.mapper.ShopMapper;
import cn.tedu.buycradserver.mapper.SpuMapper;
import cn.tedu.buycradserver.pojo.entity.Shop;
import cn.tedu.buycradserver.pojo.entity.Spu;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
@Slf4j
public class SpuControllertest {
    @Autowired
    SpuMapper spuMapper;
    @Autowired
    ShopMapper shopMapper;
    @Test
    public void spuinsert(){
        Spu spu = new Spu();
        spu.setName("你好").setTitle("nihao").setDescription("ns")
            .setListPrice(1.2).setStock(1).setCategoryId(1l).setCategoryName("ni2").setAlbumId(1l);
        int row = spuMapper.insert(spu);
       log.debug("受影响的行数为{}",row);
    }
    @Test
    public void shop(){
        Shop shop = new Shop();
        shop.setName("咕咕").setUserId(1l);
        int row = shopMapper.insert(shop);
        log.debug("受影响的行数为{}",row);
    }
}
